package com.scau.vo;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * ServiceCategory entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "service_category", catalog = "db_hairdressingpos")
public class ServiceCategory implements java.io.Serializable {

	// Fields

	private Integer id;
	private Timestamp gmtCreate;
	private Timestamp gmtModified;
	private String name;
	private String remark;
	private Set<Service> services = new HashSet<Service>(0);

	// Constructors

	/** default constructor */
	public ServiceCategory() {
	}

	/** minimal constructor */
	public ServiceCategory(Timestamp gmtCreate, String name) {
		this.gmtCreate = gmtCreate;
		this.name = name;
	}

	/** full constructor */
	public ServiceCategory(Timestamp gmtCreate, Timestamp gmtModified,
			String name, String remark, Set<Service> services) {
		this.gmtCreate = gmtCreate;
		this.gmtModified = gmtModified;
		this.name = name;
		this.remark = remark;
		this.services = services;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "gmt_create", nullable = false, length = 19)
	public Timestamp getGmtCreate() {
		return this.gmtCreate;
	}

	public void setGmtCreate(Timestamp gmtCreate) {
		this.gmtCreate = gmtCreate;
	}

	@Column(name = "gmt_modified", length = 19)
	public Timestamp getGmtModified() {
		return this.gmtModified;
	}

	public void setGmtModified(Timestamp gmtModified) {
		this.gmtModified = gmtModified;
	}

	@Column(name = "name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "remark")
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "serviceCategory")
	public Set<Service> getServices() {
		return this.services;
	}

	public void setServices(Set<Service> services) {
		this.services = services;
	}
	
	@Override
	public String toString() {
		return "{\"id\":" + id 
				+ ", \"gmtCreate\":" + "\"" +gmtCreate + "\""
				+ ", \"gmtModified\":" + "\"" +gmtModified+ "\""
				+ ", \"name\":" + "\"" +name + "\""
				+ ", \"remark\":" + "\"" +remark + "\"" 
				+ "}";
	}

}